// 统一请求路径前缀在libs/axios.js中修改
import {
  getRequest,
  postRequest,
  deleteRequest,
  uploadFile,
  managerUrl
} from "@/libs/axios";

/**
 * 实训基地检查是否存在预约单
 * @param {ids} 场地id 
 * @returns 
 */
export const checkAppointmentsNumApi = (params) => {
  return postRequest(`${managerUrl}/manager/trainingBase/trainingBase/checkBeforeDelete`, params);
};
// 获取实训基地分页列表
export const postTrainBasePage = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(`${managerUrl}/manager/trainingBase/trainingBase/pagelist`, params, headers);
};

// 获取实训基地类型
export const getTrainBaseType = () => {
  return getRequest(`${managerUrl}/manager/trainingBase/trainingBase/getTrainingBaseCategory`);
};

// 获取实训基地详情
export const getTrainBaseInfo = (id) => {
  return getRequest(`${managerUrl}/manager/trainingBase/trainingBase/${id}`);
};

// 实训基地 禁-启用基地状态
export const openCloseTrainBaseApi = (params) => {
  return postRequest(`${managerUrl}/manager/trainingBase/trainingBase/close`, params);
};
// 新增、编辑实训基地 禁-启用基地状态
export const postTrainBase = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(`${managerUrl}/manager/trainingBase/trainingBase/save`, params, headers);
};

// 获取基地所属单位
export const getTrainBaseUnit = () => {
  return getRequest(`${managerUrl}/manager/permission/department`);
};

// 上传基地封面
export const postUpload = (params) => {
  let headers = { 'Content-Type': 'multipart/form-data' };
  return postRequest(uploadFile, params, headers);
};

// 删除实训基地
export const delTrainBase = (params) => {
  return postRequest(`${managerUrl}/manager/trainingBase/trainingBase/delete`, params);
};

// 新增基地类型
export const postTrainBaseType = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(`${managerUrl}/manager/trainingBase/trainingBase/addTrainingBaseCategory`, params, headers);
};

// 删除基地类型
export const delTrainBaseType = (id) => {
  return deleteRequest(`${managerUrl}/manager/trainingBase/trainingBase/deleteTrainingBaseCategory/${id}`);
};

// 获取预约记录列表
export const postTrainBaseOrderList = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(`${managerUrl}/manager/trainingBase/trainingBase/trainingOrderRecords`, params, headers);
};

// 强制释放
export const postTrainBaseCancel = (params) => {
  let headers = { "Content-Type": "application/json"}
  return postRequest(`${managerUrl}/manager/trainingBase/trainingBase/forceCancel`, params, headers);
};